package com.cheer.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.cheer.common.Page;
import com.cheer.dto.OaLearnEntryQueryDTO;
import com.cheer.entity.OaLearnEntryEntity;
import com.cheer.vo.*;

import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;

/**
 * 报名人员
 *
 * @author cheer
 */
public interface OaLearnEntryService extends IService<OaLearnEntryEntity> {

    /**
     * 查询用户报名历史
     */
    List<OaHistoryListVO> listByUserId(Integer userId);

    /**
     * 分页查询报名列表
     */
    Page<OaLearnEntryVO> list(Integer pageNum, Integer pageSize, Integer learnId, Integer pid);

    /**
     * 分页查询报名详情列表
     */
    Page<OaLearnEntryDetailVO> detail(Integer pageNum, Integer pageSize, Integer learnId, Integer pid);

    /**
     * 查询完成率
     */
    OaLearnEntryCompareVO compare(OaLearnEntryQueryDTO learnEntryQueryDTO);

    /**
     * 查看报名人数
     */
    Integer countByLearnId(Integer learnId);

    /**
     * 查看本期排名
     */
    List<OaLearnEntryVO> listHome(Integer pid);

    /**
     * 下载报名
     */
    void download(Integer learnId, Integer pid, HttpServletResponse response);

    /**
     * 下载本期报名
     */
    void download(Date startDate, Date endDate,  Integer pid, Integer learnId);

    /**
     * 添加报名
     */
    void add(String openid, Integer learnId, Date date);

    void updatePathByDepartment(Integer department, String path);

    void updateByOpenid(OaLearnEntryEntity oaLearnEntryEntity);

    void detailDownload(Integer learnId, Integer pid, HttpServletResponse response);


    /**
     * 获取机构参与率
     * @param pid - 机构ID
     * @param startDate - 期开始时间
     * @param endDate - 期结束时间
     * @return
     */
    RateVO orgRate(Date startDate, Date endDate, Integer learnId , Integer pid);

    /**
     * 获取高校参与率
     * @param type 类型
     * @param learnId 每期的ID
     * @return
     */
    RateVO schoolRate(Date startDate, Date endDate, Integer type, Integer learnId);

    /**
     * 下载参与率导出
     * @param type
     * @param learnId
     */
    void schoolDownload(Date startDate, Date endDate, Integer type, Integer learnId);

    /**
     * 获取高校参与率
     * @param startDate 开始时间
     * @param endDate 结束时间
     * @param learnId 每期的ID
     * @return
     */
    RateVO prefectureRate(Date startDate, Date endDate, Integer learnId);

    /**
     * 区县参与率下载
     * @param startDate 开始时间
     * @param endDate 结束时间
     * @param learnId 每期的ID
     * @return
     */
    void prefectureDownload(Date startDate, Date endDate, Integer learnId);

    /**
     * 绘制表格
     * @param compare
     */
    void drawExcel(OaLearnEntryCompareVO compare);

}

